home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / DBASE_UT / TPDB335 / SORTDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1993-11-26  |  2KB  |  47 lines

  1. program SortDemo;
  2.  
  3.                            (***********************************)
  4.                            (*               TPDB              *)
  5.                            (***********************************)
  6.                            (*         Object -Oriented        *)
  7.                            (*    Borland/Turbo Pascal Units   *)
  8.                            (*    for Accessing dBASE III      *)
  9.                            (*             files.              *)
  10.                            (*      Copyright 1988 - 1993      *)
  11.                            (*          Brian Corll            *)
  12.                            (*       All Rights Reserved       *)
  13.                            (***********************************)
  14.                            (*            FREEWARE             *)
  15.                            (***********************************)
  16.                            (*     dBASE is a registered       *)
  17.                            (* trademark of Borland Int. Inc.  *)
  18.                            (*   Version 3.35  November, 1993  *)
  19.                            (***********************************)
  20.                            (*   Portions Copyright 1984,1991  *)
  21.                            (*    Borland International Corp.  *)
  22.                            (***********************************)
  23.  
  24.  
  25. uses
  26.     Crt, TPDB, TPDBSort, TPDBStr;
  27.  
  28.  
  29. {Declare a FAR function which creates the sort key expression.}
  30. {This function MUST call the SortFile object, as shown.}
  31. {$F+}
  32.  
  33. function MakeKey: DBKey;                                    {This function MUST return the type DBKey !}
  34.  
  35. begin
  36.     MakeKey := For2Eng(SortFile^.Field(1), ForTable, EngTable);
  37. end;
  38. {$F-}
  39.  
  40. begin
  41.     Writeln('Sorting TEST.DBF to SORT.DBF....');            {Set the VAR SortFunc equal to the sort key function.}
  42.     SortFunc := MakeKey;                                    {Then call the sort with the SortFunc VAR and the input and
  43.                                                                output files.}
  44.     SortOn(SortFunc, 'test.dbf', 'sort.dbf');
  45.     Writeln('Sort complete ! TPDB Version 3.35');
  46. end.
  47.